﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Bibilioteca.Models
{
    public class Reserva
    {
        public int Id { get; set; }
        
        [Display(Name = "Material Id")]
        [Required(ErrorMessage = "Por favor seleccione un material")]
        public int SelectedMaterial { get; set; }
        
        [Display(Name = "Socio Id")]
        [Required(ErrorMessage = "Por favor seleccione un socio")]
        public int SelectedSocioId { get; set; }
        
        public DateTime Fecha { get; set; }
        
        [Display(Name = "Fecha de vencimiento")]
        public DateTime FechaVencimiento { get; set; }

        [Display(Name = "Dias de prestamo")]
        [Required(ErrorMessage = "Por favor seleccione un socio")]
        public int DiasPrestamo;
        
        [Display(Name = "Ejemplar Id")]
        public int SelectedEjemplarId { get; set; }

        //@Html.ListBoxFor(model => model.Autores,"Autores", ViewBag.Autores as MultiSelectList)

        public Reserva(int _id, int materialId, int socioId, int dias,
                        DateTime _fecha, DateTime _fechavenc, int ejemplarId = -1)
        {
            Id = _id;
            SelectedMaterial = materialId;
            SelectedSocioId = socioId;
            DiasPrestamo = dias;
            
            Fecha = _fecha;
            
            FechaVencimiento = _fechavenc;
            SelectedEjemplarId = ejemplarId;
        }
    }
}